﻿config.eventcfg = {
		
	printPDF: function(){
		var self = this;
		var records = JxUtil.getSelectRows(self.grid);
		if (!JxUtil.selected(records)) return;
        
        var nodeid = self.define.nodeid;
		//取选择记录的主键值
        var params = 'funid='+ nodeid +'&query_funid='+ nodeid;
        for (var i = 0; i < records.length; i++) {
            params += '&keyid=' + records[i].get(self.define.pkcol);
        }
        //设置请求的参数
        params += '&eventcode=pdfnew&model_id=jxstar8321';
		
        var hdcall = function(data) {
            var filename = data.filename;
            if (!filename) {
                JxHint.alert('not find pdf file!');
                return;
            }
            var e = encodeURIComponent;
            var params = 'funid='+nodeid+'&eventcode=pdfdown&filename=' + e(filename);
            
            JxAttach.previewPDF('PDF_PRINT','PDF_PRINT.pdf',params);
        };
        //发送请求
        Request.postRequest(params, hdcall);
	}
        
}